package com.lagou.edu.controller;

import com.lagou.edu.api.CodeService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yutao
 * @create 2020-07-05 17:37
 **/
@RestController
@RequestMapping("code")
public class CodeController {

    @Reference
    private CodeService codeService;

    @GetMapping("/create/{email}")
    public  Boolean create(@PathVariable("email") String email){
        return codeService.create(email);
    }

    @GetMapping("/validate/{email}/{code}")
    public Integer validate(@PathVariable("email") String email, @PathVariable("code") String code){
        return codeService.validate(email,code);
    }
}
